package com.yomahub.liteflow.example.threadproject;

import java.util.concurrent.LinkedBlockingQueue;

/**
 * 验证任务队列没有释放阻塞
 */
public class QueueTest {
    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingQueue<Object> blockingQueue = new LinkedBlockingQueue<>(5);

        for (int i = 0; i < 10; i++) {

            blockingQueue.put(i);
            System.out.println("put" + i + "成功后，的剩余容量："+ blockingQueue.remainingCapacity());
//            源代码中：
//            while (count.get() == capacity) {
//                notFull.await(); // 队列中的元素等于最大队列数时，队列阻塞，等待唤醒
//            }

        }

    }
}
